perm filename PUMA.PAL[11,HE] blob
sn#583097 filedate 1981-05-04 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00004 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 Program to talk to one of the PUMA's with the VT05
C00005 00003 VT05 I/O routines
C00007 00004 Data & Constants
C00008 ENDMK
C⊗;
;Program to talk to one of the PUMA's with the VT05
.INSRT STUFF.PAL[11,ARG]
;DZ11 definitions
DZCSR = 160000 ;Control and Status register
DZLPR = 160002 ;Line Parameter register (write only)
DZRBUF = 160002 ;Receiver Buffer register (read only)
DZTCR = 160004 ;Transmitter Control register (byte)
DZTBUF = 160006 ;Transmitter Buffer (byte, write only)
.=1000
START: RESET
MOV #START,SP ;Set up the stack
MOV #BEGMES,R1 ;Tell world who we are
JSR PC,OUTSTR
MOV #CRLF,R1
JSR PC,OUTSTR
;Set up the DZ11 using line # in LINE
MOV #13430,R0 ;line parameters: 1200 baud, 8 char, no parity
BIS LINE,R0 ;Choose which line
MOV R0,DZLPR ;Tell DZ11 what parameters to use
MOV #1,R0
ASH LINE,R0 ;Set up transmit bit for line we're using
MOVB R0,DZTCR ;Turn on transmit for line
BIS #40,DZCSR ;Turn on master scan enable
;Now talk
TLOOP: JSR PC,INCHR ;Any input - returned in R0
TST R0
BEQ 2$ ; No - go check if anything to print
CMP #3,R0 ;Was it a ↑C? (Do we really want this?)
BNE 1$ ; No
BPT ; Yes - break to DDT
BR 2$ ; Proceeding will just continue
1$: TST DZCSR ;Can we send it yet?
BPL 1$ ; No - wait til we can (This may not work)
MOVB R0,DZTBUF ;Send input char over
2$: MOV DZRBUF,R0 ;See if anything to output
BPL TLOOP ; No
JSR PC,OUTCHR ; Yes - print it
BR TLOOP ;Do it all again
;VT05 I/O routines
OUTSTR: MOVB (R1)+,R0 ;Get next char
BEQ 1$ ;If done - quit
JSR PC,OUTCHR ;Print it
BR OUTSTR
1$: JSR PC,OUTCHR ;Print a couple nulls
JSR PC,OUTCHR
; JMP OUTCHR
OUTCHR: TST OUTSW ;Who does it go to?
BEQ 2$
1$: TSTB KBOS ;VT05 ready?
BPL 1$ ;Loop til it is
MOVB R0,KBOR ;Print the char
RTS PC
2$: TSTB OREG ;Console ready?
BNE 2$ ;Wait til it is
MOVB R0,OREG ;Output char
RTS PC
INCHR: TST OUTSW ;Where does it come from?
BEQ 1$
TSTB KBIS ;Anything typed on VT05?
BPL 2$ ; No
MOVB KBIR,R0 ; Read the char
RTS PC
1$: TSTB IREG ;Anything from the 10?
BEQ 2$ ; No
MOVB IREG,R0 ; Fetch the char
CLRB IREG
RTS PC
2$: CLR R0 ;No input
RTS PC
;Data & Constants
LINE: .WORD 1 ;Which DZ11 line we are using
BEGMES: .ASCII /πPuma terminal program/
CRLF: .BYTE 12,15,0
.END START